ArcPad Scripting Object Model
ListArchive Example
Send Feedback
ArcPad Scripting Object Model Reference > ArcPad Scripting Samples > ListArchive Example

Glossary Item Box

Description

Displays all files inside in the input ZIP file (strArchiveFile).
Please note that only files in the root folder of the ZIP file are displayed.

VBScript Code

Copy Code
 Sub ListArchive(strArchiveFile)
      
      ' Open the ZIP archive
      Dim pArchive
      Set pArchive = Application.CreateAppObject("Archive")
      If (Not pArchive.Open(strArchiveFile)) Then Exit Sub
      
      ' Retrieve a list of files in the root folder
      Dim arrFileList, strOutput
      arrFileList = pArchive.FindFiles("*")
      
      ' Build up a string containing the names of all files in the list
      If (IsArray(arrFileList)) Then
            strOutput = CStr(UBound(arrFileList) - LBound(arrFileList) + 1) & " file(s) in archive " & strArchiveFile & "."
            Dim strFile
            For Each strFile In arrFileList
                  strOutput = strOutput & vbNewline & strFile
            Next
      Else
            strOutput = "No files in archive."
      End If
      
      ' Close the ZIP archive
      pArchive.Close()
      
      ' Display the list of files found
      Application.MessageBox strOutput, apInformation, "ListArchive"
End Sub
©2012. All Rights Reserved.